package com.ruoyi.report.forms.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.report.forms.domain.CngScadaStationCt;
import com.ruoyi.report.forms.service.ICngScadaStationCtService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 场站 SCADA场站档案Controller
 * 
 * @author ruoyi
 * @date 2024-02-29
 */
@RestController
@RequestMapping("/ctStation")
public class CngScadaStationCtController extends BaseController
{
    @Autowired
    private ICngScadaStationCtService cngScadaStationCtService;

    /**
     * 查询场站 SCADA场站档案列表
     */
    /*@RequiresPermissions("system:ct:list")*/
    @GetMapping("/listReport")
    public TableDataInfo list(CngScadaStationCt cngScadaStationCt)
    {
        /*startPage();*/
        List<CngScadaStationCt> list = cngScadaStationCtService.selectCngScadaStationCtList(cngScadaStationCt);
        return getDataTable(list);
    }

    /**
     * 导出场站 SCADA场站档案列表
     */
    /*@RequiresPermissions("system:ct:export")*/
    @Log(title = "场站 SCADA场站档案", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CngScadaStationCt cngScadaStationCt)
    {
        List<CngScadaStationCt> list = cngScadaStationCtService.selectCngScadaStationCtList(cngScadaStationCt);
        ExcelUtil<CngScadaStationCt> util = new ExcelUtil<CngScadaStationCt>(CngScadaStationCt.class);
        util.exportExcel(response, list, "场站 SCADA场站档案数据");
    }

    /**
     * 获取场站 SCADA场站档案详细信息
     */
    /*@RequiresPermissions("system:ct:query")*/
    @GetMapping(value = "/{stationId}")
    public AjaxResult getInfo(@PathVariable("stationId") String stationId)
    {
        return success(cngScadaStationCtService.selectCngScadaStationCtByStationId(stationId));
    }

    /**
     * 新增场站 SCADA场站档案
     */
    /*@RequiresPermissions("system:ct:add")*/
    @Log(title = "场站 SCADA场站档案", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CngScadaStationCt cngScadaStationCt)
    {
        return toAjax(cngScadaStationCtService.insertCngScadaStationCt(cngScadaStationCt));
    }

    /**
     * 修改场站 SCADA场站档案
     */
    /*@RequiresPermissions("system:ct:edit")*/
    @Log(title = "场站 SCADA场站档案", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CngScadaStationCt cngScadaStationCt)
    {
        return toAjax(cngScadaStationCtService.updateCngScadaStationCt(cngScadaStationCt));
    }

    /**
     * 删除场站 SCADA场站档案
     */
    /*@RequiresPermissions("system:ct:remove")*/
    @Log(title = "场站 SCADA场站档案", businessType = BusinessType.DELETE)
	@DeleteMapping("/{stationIds}")
    public AjaxResult remove(@PathVariable String[] stationIds)
    {
        return toAjax(cngScadaStationCtService.deleteCngScadaStationCtByStationIds(stationIds));
    }
}
